/*
* File:   SynchronizedPriorityQueue.h
* Author: henrya
*
* Created on June 27, 2009, 5:02 PM
*/

#ifndef _SYNCHRONIZEDPRIORITYQUEUE_H
#define	_SYNCHRONIZEDPRIORITYQUEUE_H

#include <queue>
#include <pthread.h>
#include <vector>
#include <limits>
using std::numeric_limits;

using std::vector;
using std::priority_queue;
using std::greater;

class SynchronizedPriorityQueue {
public:
	SynchronizedPriorityQueue(unsigned int size = numeric_limits<unsigned int>::max());
	virtual ~SynchronizedPriorityQueue();
	bool push(int num);
	int pop();
	unsigned int size();
private:
	priority_queue< int, vector<int>, greater<int> >  queueue;
	pthread_mutex_t classLock;
	unsigned int maxSize;
};

#endif	/* _SYNCHRONIZEDPRIORITYQUEUE_H */

